package JAVA300.第六章异常;
/*
运行时异常
 */
public class TestRunTime {
    public static void main(String[] args) {

        String str = null;
        if (str != null){//判断指针是否为空
            System.out.println(str.length());;
        }

        Animal a = new Cat();
        if(a instanceof Dog){//判断实例语句
            Dog dog = (Dog)a;
        }
      //  Dog dog = (Dog)a;//ClassCastExceptio

    }
}

class Animal{

}
class Dog extends Animal{

}
class Cat extends Animal{

}
